#!/bin/bash
. ./lib

options=()
options+=("os-prober" "Detect OS for multi-boot (grub)" off)
options+=("snapper" "snapshot manager (ext4, lvm, btrfs)" off)
options+=("dosfstools" "FAT32 file support (Windows Drives)" on)
options+=("ntfs-3g" "NTFS file support (Windows Drives)" on)
options+=("btrfs-progs" "BTRFS file utils" on)
options+=("exfat-utils" "EXFAT file support" on)
options+=("gptfdisk" "" on)
options+=("autofs" "" on)
options+=("fuse2" "" on)
options+=("fuse3" "" on)
options+=("fuseiso" "" on)
options+=("sshfs" "SSH client" off)
options+=("cifs-utils" "SMB mount command" off)
options+=("smbclient" "SMB full client" off)
options+=("nfs-utils" "" off)
options+=("open-iscsi" "" off)
options+=("glusterfs" "" off)
options+=("hfsprogs" "(AUR)" off)
options+=("mtpfs" "" off)
options+=("unionfs-fuse" "" off)
options+=("nilfs-utils" "" off)
options+=("gvfs" "" off)
options+=("s3fs-fuse" "" off)
#options+=("fuse-exfat" "" off) # Normally installed by dependencies
#options+=("f2fs-tools" "" off) # Normally installed by dependencies
#options+=("favfs2" "" off) # Normally installed by dependencies

sel=$(whiptail --backtitle "$apptitle" --title "File System Install" --checklist "" --cancel-button "Back" 0 0 0 \
  "${options[@]}" \
  3>&1 1>&2 2>&3)

if [ ! "$?" = "0" ]; then
  exit 1
fi

for itm in $sel; do
  case $itm in
    '"hfsprogs"')
      aurpkg="$aurpkg $(echo $itm | sed 's/"//g')"
    ;;
    *) pkg="$pkg $(echo $itm | sed 's/"//g')";;
  esac
done

instpkg "$pkg" "$aurpkg"

exit 0
